package com.ciaojian.client.controller;

import com.ciaojian.client.service.WorkerInviteServiceImpl;
import com.ciaojian.core.base.annotation.ApiIdempotent;
import com.ciaojian.core.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;

/**
 * @author Atlakyn
 */
@Api(tags = "邀请相关接口")
@RestController
@RequestMapping("/invite")
public class InviteController {
    @Resource
    private WorkerInviteServiceImpl workerInviteService;

    @ApiOperation(value = "发型师邀请会员", consumes = "application/x-www-form-urlencoded")
    @ApiIdempotent
    @PostMapping
    public Result workerInviteUser(@ApiParam("发型师id") @NotNull Integer workerId,
                                   @ApiParam("用户id") @NotNull Integer userId) {

        workerInviteService.inviteUser(workerId, userId);
        return Result.ok();
    }

}
